Solving 10385 - Duathlon (Ternary search)
[and.git] / 11202 - The least possible effort / p11202.cpp
blobeb16228f1ef0f9e2f4bbd8f051768533c4b63638
1 #include <iostream>
2 #include <math.h>
4 using namespace std;
6 int main(){
7 unsigned int t;
8 cin >> t;
9 while (t--){
10 int n, m;
11 cin >> n >> m;
12 double x = ceil(n/2.0), y = ceil(m/2.0);
13 if (n != m){
14 cout << (unsigned long)(x*y) << endl;
15 }else{
16 cout << (unsigned long)(x*y - (x*(x-1))/2.0) << endl;
19 return 0;